package org.nanotek.service;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.validation.constraints.NotNull;

import org.nanotek.base.person.Person;
import org.nanotek.persistence.inject.PersonTypeDAO;
import org.nanotek.persistence.jpa.base.person.PersonDAO;

@Local
@Stateless
public class PersonService {

	@Inject @PersonTypeDAO PersonDAO<Person> personDAO; 
	
	public <I extends Object> Person findPerson(@NotNull I id)
	{ 
		return personDAO.find(id);
	}
	
	@Transactional
	public void addPerson (Person person)
	{ 
		personDAO.persist(person);
	}
	
	public List<Person> getPersonList()
	{ 
		return personDAO.loadAll();
		
	}
	
}

